﻿using CoreModule;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;
namespace UIModule
{
    /// <summary>
    /// 
    /// </summary>
    /// 
    [Module(ModuleName = "UIModule")]
    [ModuleDependency("CoreModule")]
    public class Module : IModule
    {
        IWindowLifetime WindowLifetime;
        IRegionManager RegionManager;
        public Module(IRegionManager regionManager, IWindowLifetime windowLifetime)
        {
            RegionManager=regionManager;
            WindowLifetime = windowLifetime;
         
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="containerProvider"></param>
        public void OnInitialized(IContainerProvider containerProvider)
        {
            var navigationParameters = new NavigationParameters
                {
                    {
                          CoreConstant.BluetoothDataPickerResultKey, Cache.BluetoothDataPickerResult
                    },

                };
             
            RegionManager.RequestNavigate(CoreConstant.MainRegion, CoreConstant.HistoryView, navigationParameters);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="containerRegistry"></param>
        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterForNavigation<Views.History20240725,ViewModels.HistoryViewModel>(CoreConstant.HistoryView);
            containerRegistry.RegisterForNavigation<Views.Analysis20240725,ViewModels.AnalysisViewModel>(CoreConstant.AnalysisView);


            containerRegistry.RegisterForNavigation<Views.Blank>(CoreConstant.BlankView);

            containerRegistry.Register<Views.BluetoothDataPicker>(CoreConstant.BluetoothDataPickerWindow);
            ///
            
         
        }
    }
}